<?php 
		if($_POST['hoanbn_hidden'] == 'Y') {
			//Form data sent
			$dbhost = $_POST['hoanbn_dbhost'];
			update_option('hoanbn_dbhost', $dbhost);
			
			$dbname = $_POST['hoanbn_dbname'];
			update_option('hoanbn_dbname', $dbname);
			
			$dbuser = $_POST['hoanbn_dbuser'];
			update_option('hoanbn_dbuser', $dbuser);
			
			$dbpwd = $_POST['hoanbn_dbpwd'];
			update_option('hoanbn_dbpwd', $dbpwd);
	
			$prod_img_folder = $_POST['hoanbn_prod_img_folder'];
			update_option('hoanbn_prod_img_folder', $prod_img_folder);
	
			$store_url = $_POST['hoanbn_store_url'];
			update_option('hoanbn_store_url', $store_url);
			?>
			<div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div>
			<?php
		} else {
			//Normal page display
			$dbhost = get_option('hoanbn_dbhost');
			$dbname = get_option('hoanbn_dbname');
			$dbuser = get_option('hoanbn_dbuser');
			$dbpwd = get_option('hoanbn_dbpwd');
			$prod_img_folder = get_option('hoanbn_prod_img_folder');
			$store_url = get_option('hoanbn_store_url');
		}
?>
<div class="wrap">
	<?php    echo "<h2>" . __( 'HoanBN Product Display Options', 'hoanbn_trdom' ) . "</h2>"; ?>
	
	<form name="hoanbn_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
		<input type="hidden" name="hoanbn_hidden" value="Y">
		<?php    echo "<h4>" . __( 'HoanBN Database Settings', 'hoanbn_trdom' ) . "</h4>"; ?>
		<p><?php _e("Database host: " ); ?><input type="text" name="hoanbn_dbhost" value="<?php echo $dbhost; ?>" size="20"><?php _e(" ex: localhost" ); ?></p>
		<p><?php _e("Database name: " ); ?><input type="text" name="hoanbn_dbname" value="<?php echo $dbname; ?>" size="20"><?php _e(" ex: oscommerce_shop" ); ?></p>
		<p><?php _e("Database user: " ); ?><input type="text" name="hoanbn_dbuser" value="<?php echo $dbuser; ?>" size="20"><?php _e(" ex: root" ); ?></p>
		<p><?php _e("Database password: " ); ?><input type="text" name="hoanbn_dbpwd" value="<?php echo $dbpwd; ?>" size="20"><?php _e(" ex: secretpassword" ); ?></p>
		<hr />
		<?php    echo "<h4>" . __( 'HoanBN Store Settings', 'hoanbn_trdom' ) . "</h4>"; ?>
		<p><?php _e("Store URL: " ); ?><input type="text" name="hoanbn_store_url" value="<?php echo $store_url; ?>" size="20"><?php _e(" ex: http://www.yourstore.com/" ); ?></p>
		<p><?php _e("Product image folder: " ); ?><input type="text" name="hoanbn_prod_img_folder" value="<?php echo $prod_img_folder; ?>" size="20"><?php _e(" ex: http://www.yourstore.com/images/" ); ?></p>
		
	
		<p class="submit">
		<input type="submit" name="Submit" value="<?php _e('Update Options', 'hoanbn_trdom' ) ?>" />
		</p>
	</form>
</div>